home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 2 / CU Amiga Magazine's Super CD-ROM 02 (1996)(EMAP Images)(GB)[!][issue 1996-04].iso / magazine / amiga_e / epp / pmodules / systime.e < prev    next >
Text File  |  1980-01-05  |  1KB  |  41 lines

  1. OPT TURBO
  2.  
  3. /*---------------------------------------------------------------------*/
  4. /* Module systemTimeStr() function.  This is necessary for KS1.3 users */
  5. /* since we can't use the utilities.library, nor the DatetoStr()       */
  6. /* function of the newer OS.                                           */
  7. /*---------------------------------------------------------------------*/
  8.  
  9. MODULE 'dos/datetime', 'dos/dos'
  10. PMODULE 'PMODULES:itoa'
  11.  
  12. PROC buildTimeStr(theString, hour, minute, second)
  13.   DEF tempStr[2]:STRING
  14.   SetStr(theString, 0)
  15.   itoa(tempStr, hour)
  16.   IF hour<10 THEN StrAdd(theString, '0', ALL)
  17.   StrAdd(theString, tempStr, ALL)
  18.   StrAdd(theString, ':', ALL)
  19.  
  20.   itoa(tempStr, minute)
  21.   IF minute<10 THEN StrAdd(theString, '0', ALL)
  22.   StrAdd(theString, tempStr, ALL)
  23.   StrAdd(theString, ':', ALL)
  24.  
  25.   itoa(tempStr, second)
  26.   IF second<10 THEN StrAdd(theString, '0', ALL)
  27.   StrAdd(theString, tempStr, ALL)
  28. ENDPROC theString
  29.   /* buildTimeStr */
  30.  
  31. PROC systemTimeStr(theString)
  32.   DEF ds:PTR TO datestamp, hour, minute, second
  33.   ds:=DateStamp(New(SIZEOF datestamp))
  34.   hour:=ds.minute/60
  35.   minute:=ds.minute-(hour*60)
  36.   second:=ds.tick/50
  37.   Dispose(ds)
  38. ENDPROC buildTimeStr(theString, hour, minute, second)
  39.   /* systemTimeStr */
  40.  
  41.